<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simSetReferencedHandles</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1><a href="../apiOverview.htm">Regular API</a> function</h1>
<h3 class=subsectionBar><a name="simSetReferencedHandles" id="simSetReferencedHandles"></a>simSetReferencedHandles / sim.setReferencedHandles </h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>
Attaches a list of custom handles to a given scene object. Those custom handles are handles of other objects, that are linked to the given scene object (for whatever purpose). The advantage of storing references to other objects with this function is that CoppeliaSim will take care of correctly adjusting the references if needed: For instance, imagine <em>objectA</em> storing the handle of <em>objectB</em> via this function. If <em>objectB</em> is deleted, then the stored handle will become -1. If <em>objectA</em> and <em>objectB</em> are duplicated at the same time, then the duplicate of <em>objectA</em> will store the handle of the duplicate of <em>objectB</em>. Optionally, if <em>sim.handleflag_keeporiginal </em>is specified, then linking to original objects is guaranteed, e.g. in above example, after a duplication of <em>objectA</em>, the duplicate of <em>objectA</em> will store the handle of the original <em>objectB</em> (if <em>objectB</em> still exists). See also <a href="simGetReferencedHandles.htm">sim.getReferencedHandles</a>. </td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simInt simSetReferencedHandles(simInt objectHandle,simInt count,const simInt* referencedHandles,const simInt* reserved1,const simInt* reserved2)</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>objectHandle</strong>: handle of the scene object that will store the list of handles. Can be optionally combined with <em>sim.handleflag_keeporiginal</em>, in which case the handles that link to originals are retrieved.</div>
<div><strong>count</strong>: the number of handles to store</div>
<div><strong>referencedHandles</strong>: a list of handles. Handles of following object types are supported: scene objects, collision objects, distance objects, IK groups and collections.</div>
<div><strong>reserved1</strong>: reserved for future extensions</div>
<div><strong>reserved2</strong>: reserved for future extensions</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>-1 in case of an error.</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn>sim.setReferencedHandles(number objectHandle,table referencedHandles)</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div>Similar to the  C-function</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div>none</div>
</td> 
</tr> 
</table> 

<br>
<p><a href="../apiFunctions.htm">All regular API functions on one page</a></p>
<br>
<br>
</td>
</tr>
</table>
</div>
</body>
</html>
